<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">

<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <meta name="viewport"
          content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no">

    <title>确认购买</title>

    <link href="__PUBLIC__/AmazeUI-2.4.2/assets/css/amazeui.css" rel="stylesheet" type="text/css"/>
    <link rel="stylesheet" href="__PUBLIC__/basic/css/demo.css">
    <link rel="stylesheet" href="__PUBLIC__/css/index.css">

    <style>
        .shopbox{
            position:fixed;height: 45px;background-color: #FFFFFF;line-height: 45px;bottom:0px;
        }
        .select{
            padding: 0 0 0 5px;
        }
        .select span{
            font-size: 11px;vertical-align: middle;color: #787878;
        }
        .totol{
            font-size: 11px;color: #787878;margin-left: 5px;
        }
        .totol span{
            font-size: 15px;color: #FF0000;
        }
        .goset{
            background-color: #FFAD01;font-size: 18px;color: #fff;text-align: center;display: inline-block;width: 100%;
        }

        .order-title .am-u-sm-12 {
            padding: 6px 6px;
            border-bottom: 1px solid #F2F2F2;
        }

        .order-title .am-u-sm-12 .ti {
            font-size: 18px;
            color: #000;
            vertical-align: middle;
            display: inline-block;
            line-height: 25px;
            margin-left: 8px;
        }

        .info-box{
            background: url('__PUBLIC__/new_images/boder_sm.png') repeat-x;background-size: 100%;line-height: 26px;position: relative;
        }
        .info-box .nick{
            font-size: 14px;color: #DFDFDF;margin-right: 20px;
        }
        .info-box .phone{
            font-size: 14px;color: #999;
        }
        .info-box .default{
            border: 1px solid #FFAD01;color: #FFAD01;display: inline-block;border-radius: 3px;padding: 2px;margin-right: 20px;line-height: 1em;font-size: 12px;
        }
        .info-box .edit{
            position: absolute;top: 24px;right: 10px;
        }

        /*.goods-box {*/
            /*margin-bottom: 10px;*/
        /*}*/

        .goods-box .goods-head {
            border-bottom: 1px solid #F3F3F3;
            padding: 15px 20px 10px;
            font-size: 13px;
        }

        .goods-box .good-content {
            padding: 10px 5px 0px 0;
            border-bottom: 1px solid #D8D8D8;
        }

        .goods-box .good-content .title {
            position: absolute;
            top: 3px;
            color: #2C2D2F;
            font-size: 11px;
            height: 55px;
            line-height: 18px;
            display: -webkit-box;
            -webkit-box-orient: vertical;
            -webkit-line-clamp: 3;
            overflow: hidden;
            letter-spacing: 0;
            vertical-align: middle;
        }

        .goods-box .good-content .map {
            color: #787878;
            font-size: 9px;
            position: absolute;
            top: 58px;
            left: 110px;
        }

        .goods-box .good-price {
            margin-bottom: 10px;
        }

        .goods-box .good-price .money {
            text-overflow: ellipsis;
            display: block;
            line-height: 30px;
        }

        .goods-box .good-price .num {
            margin-left: 3px;
            color: #898989;
        }

        .goods-box .good-totol {
            margin-bottom: 15px;
        }

        .goods-box .good-totol span {
            display: block;
            font-size: 13px;
        }
    </style>

</head>

<body class="bg-default">


<div class="am-g bg-white order-title">
    <div class="am-u-sm-12">
        <a href="javascript:history.back(-1);"><img src="__PUBLIC__/new_images/left.png" width="28" alt=""></a> <span class="ti">订单管理</span>
    </div>

    <a href="#">
        <div class="am-u-sm-12 info-box" style="padding: 10px 30px 10px 15px;min-height: 64px">
            <span class="nick" style="">{$order.consignee}</span> <span class="phone">{$order.mobile}</span><br>
            <span class="default">默认</span>
            <span class="phone">{$order.area} {$order.address}</span>
            <a href="__URL__/selectAddress?order_id={$order.order_id}"><img src="__PUBLIC__/new_images/right.png" width="20" alt="" class="edit"></a>
        </div>
    </a>
</div>

<div class="am-g">
    <div class="am-u-sm-12">
        <span style="font-size: 14px;color: #888;line-height: 30px;">确定订单信息</span>
    </div>
</div>
<form id="pay">
    <input type="hidden" name="addressId" value="{$order.address_id}">
    <input type="hidden" name="type" value="{$type}">
    <input type="hidden" name="order_id" value="{$order.order_id}">
<div class="am-g goods-box bg-white">
    <div class="am-u-sm-12 good-content">
        <assign name="i" value="0">
        <volist name="goodsList" id="vo">
<!--            <eq name="type" value="2">
                <input type="hidden" name="goodsInfos[<?php echo $i; ?>][goodsId]" value="{$vo.id}">
                <else/>
                <input type="hidden" name="goodsInfos[<?php echo $i; ?>][goodsId]" value="{$vo.goods_id}">
            </eq>

            <input type="hidden" name="goodsInfos[<?php echo $i; ?>][specKey]" value="{$vo.spec_key}">
            <input type="hidden" name="goodsInfos[<?php echo $i++; ?>][number]" value="{$vo.goods_num}">-->
        <div class="am-u-sm-10 ">
            <eq name="type" value="2">
                <img src="{$vo.image_url}" alt="" width="85" height="75">
                <else/>
                <!--<img src="{$vo.goods_id|goods_thum_images=110,110}" alt="" width="85" height="75">-->
                <img src="{$vo.image_url}" alt="" width="85" height="75">
            </eq>
            <span class="title">{$vo.goods_name}</span>
            <!--<span class="map">{$vo.region_pri} {$vo.region_city}</span>-->
            <span class="map">{$vo.region_name}</span>
        </div>
        <div class="am-u-sm-2 am-padding-0 good-price">
            <span class="money"><nobr>￥{$vo.goods_price}</nobr></span>
            <span class="num">x{$vo.goods_num}</span>
            <span class="money"><nobr>￥{$vo.price}</nobr></span>
        </div>
        </volist>


    </div>

</div>

<style>
    textarea{
        width: 98%;
        border: none;
        outline: none;
        resize:none;
        line-height: 20px;
    }
</style>
<div class="am-g bg-white" style="margin-bottom: 10px;">
    <div class="am-u-sm-12" style="font-size: 14px;color: #999;line-height: 40px;border-bottom: 1px solid #D8D8D8;">
        <span>配送方式</span><span class="" style="float: right">快递：{$freight}</span>
    </div>
    <div class="am-u-sm-3 am-padding-right-0">
        <span style="font-size: 14px;color: #999;line-height: 30px;">买家留言</span>
    </div>
    <div class="am-u-sm-9 am-padding-0 am-text-center">
        <textarea name="user_note" class="" rows="5" placeholder="对本次交易的说明" ></textarea>
    </div>
</div>
    <div class="am-g" style="margin-bottom: 100px;">
        <input type="hidden" name="pay_type" />

    </div>

<div class="am-g shopbox" >
    <div class="am-u-sm-3 select" style=""><img src="__PUBLIC__/new_images/yes.png" width="24" alt=""><span style="margin-left: 5px;">已选(<span>1</span>) </span>
    </div>
    <div class="am-u-sm-5 am-text-right am-padding-left-0"><span class="totol">合计:<span
    >￥<span  style="overflow: hidden;">{$totle}</span></span></span></div>
    <div class="am-u-sm-4 am-padding-0"><a href="#" class="goset" onclick="confirmOrder()">去付款</a>
    </div>
</div>
</form>



</body>
<script src="__PUBLIC__/AmazeUI-2.4.2/assets/js/jquery.min.js"></script>
<script src="__PUBLIC__/AmazeUI-2.4.2/assets/js/amazeui.min.js"></script>
<script src="__PUBLIC__/js/shopcart.js"></script>
<script src="__PUBLIC__/js/global.js"></script>
<script src="__PUBLIC__/layer/layer.js"></script>

<style>
    .layui-layer-btn .layui-layer-btn0 {
        border-color: #ffad01;
        background-color: #ffad01;
        color: #fff;
    }

</style>
<script>
    $(function () {
        var w = document.body.clientWidth / 12 * 10 - 115;
        $('.title').css('width', w);
        $('.title').css('left', 110);
  /*      if({$no_address}){
            window.location.href='__URL__/selectAddress';
        }*/

    });


/*    function confirmOrder(){
        if($('[name=addressId]').val() == 0){
            console.info($('[name=addressId]').val());
            layer.msg('未选择地址');
            return ;
        }

        layer.msg('请选择支付方式？', {
                    btn: ['微信支付', '余额支付']
                    ,shadeClose: true
//                    ,time:0
                    , yes: function (index, layero) {
                        layer.close(index);
                        $('[name=pay_type]').val(2);
                        var formData = new FormData(document.getElementById('pay'));

                        $.ajax({
                            type: "post",
                            url: "__URL__/shop4",
                            data: formData,
                            processData: false,
                            contentType: false,
                            error: function (data) {
                                alert('服务器忙');
                                console.info(data);
                            },
                            success: function (data) {
                                console.info(data);
                                if (data.status >= 0) {
                                    docallpay();
                                } else {
                                    layer.msg(data.msg);
                                }
                            }


                        })

                    }

                    ,btn2: function (index, layero) {

                        layer.close(index);
                        $('[name=pay_type]').val(1);
                        var formData = new FormData(document.getElementById('pay'));
                        layer.msg('您确认要支付吗？', {
//                            time: 0 //不自动关闭
                             btn: ['确认', '取消']
                            ,shadeClose : true
                            , yes: function (index, layero) {

                                layer.close(index);
                                $.ajax({
                                    type: "post",
                                    url: "__URL__/shop4",
                                    data: formData,
                                    processData: false,
                                    contentType: false,
                                    error: function (data) {
                                        alert('服务器忙');
                                        console.info(data);
                                    },
                                    success: function (data) {
                                        console.info(data);
                                        if (data.status >= 0) {
                                            layer.msg('支付成功', {type: 1}, function () {
                                                window.location.href = '__APP__/Home/Me';
                                            });

                                        } else {
                                            layer.msg(data.msg);
                                        }
                                    }
                                }
                                )
                            }
                        }
                        )
                    }
                }
        );




    }*/

    function confirmOrder(){
        if($('[name=addressId]').val() == 0){
            console.info($('[name=addressId]').val());
            layer.msg('未选择地址');
            return ;
        }
        layer.confirm('请选择支付方式？', {
                    btn: ['微信支付', '余额支付']
                }
                , function () {
                    $('[name=pay_type]').val(2);
                    var formData = new FormData(document.getElementById('pay'));

                    $.ajax({
                        type:"post",
                        url:"__URL__/shop4",
                        data : formData,
                        processData: false,
                        contentType: false,
                        error:function (data){
                            alert('服务器忙');
                            console.info(data);
                        },
                        success:function (data) {
                            console.info(data);
                            if(data.status>=0){
                                window.location.href='http://www.jipintc.com/Home/ShopCart/shop5?order_id='+data.order_id;
                            }else{
                                layer.msg(data.msg);
                            }
                        }
                    })

                }

                , function () {

                    $('[name=pay_type]').val(1);
                    var formData = new FormData(document.getElementById('pay'));
                    layer.msg('您确认要支付吗？', {
                        time: 0 //不自动关闭
                        , btn: ['确认', '取消']
                        , yes: function () {
                            $.ajax({
                                type: "post",
                                url: "__URL__/shop4",
                                data: formData,
                                processData: false,
                                contentType: false,
                                error: function (data) {
                                    alert('服务器忙');
                                    console.info(data);
                                },
                                success: function (data) {
                                    console.info(data);
                                    if (data.status >= 0) {
                                        layer.msg('支付成功', {type: 1}, function () {
                                            window.location.href = '__APP__/Home/Me';
                                        });

                                    } else if(data.status == -5){
                                        layer.msg(data.msg, {type: 1, time:1000}, function () {
                                            window.location.href='http://www.jipintc.com/Home/ShopCart/shop5?order_id='+data.order_id+ '&use_money='+'1';
                                        });
                                    }
                                }
                            })
                        }
                    })}
        );




    }

</script>

<script type="text/javascript">
    //调用微信JS api 支付
    function jsApiCall()
    {
        WeixinJSBridge.invoke(
            'getBrandWCPayRequest',
            {$jsApiParameters},
            function(res){
                WeixinJSBridge.log(res.err_msg);
//                alert(res.err_code+res.err_desc+res.err_msg);
                console.info(res.return_code);
                if(res.return_code == "SUCCESS"){
                    window.location.href='__APP__/Home/Me';
                }else{
                    window.location.href='__APP__/Home/Me';
                }
//                else{
//                    window.location.href='__APP__/Home/Order/index?type=1';
//                }
            }
        );
    }

    function docallpay()
    {
        if (typeof WeixinJSBridge == "undefined"){
            if( document.addEventListener ){
                document.addEventListener('WeixinJSBridgeReady', jsApiCall, false);
            }else if (document.attachEvent){
                document.attachEvent('WeixinJSBridgeReady', jsApiCall);
                document.attachEvent('onWeixinJSBridgeReady', jsApiCall);
            }
        }else{
            jsApiCall();
        }
    }
</script>
<script type="text/javascript">
    //获取共享地址
    function editAddress()
    {
        WeixinJSBridge.invoke(
            'editAddress',
            {$editAddress},
            function(res){
                var value1 = res.proviceFirstStageName;
                var value2 = res.addressCitySecondStageName;
                var value3 = res.addressCountiesThirdStageName;
                var value4 = res.addressDetailInfo;
                var tel = res.telNumber;

                //alert(value1 + value2 + value3 + value4 + ":" + tel);
            }
        );
    }

    window.onload = function(){
        if (typeof WeixinJSBridge == "undefined"){
            if( document.addEventListener ){
                document.addEventListener('WeixinJSBridgeReady', editAddress, false);
            }else if (document.attachEvent){
                document.attachEvent('WeixinJSBridgeReady', editAddress);
                document.attachEvent('onWeixinJSBridgeReady', editAddress);
            }
        }else{
            editAddress();
        }
    };




</script>


</html>